

package com.scs.application.modules.cert.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.scs.application.core.model.DataEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 供应商资质仓库实体对象
 *
 */
@TableName("certificate_repository")
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
public class CertificateRepository extends DataEntity implements Serializable {

    /** 供应商ID */
    /**
     * @NotBlank(message="供应商ID不能为空")
     */
    private String supplierId;

    /**
     * 资质类型
     */
    /*@NotBlank(message="资质类型不能为空")*/
    private String businessTypeCode;

    /** 目标ID */
    /**
     * @NotBlank(message="目标ID不能为空")
     */
    private String targetDescribeId;

    /**
     * 资质ID
     */
    private String certificateId;

    /**
     * 资质编号
     */
    private String certificateNo;

    /**
     * 有效期开始
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    private java.util.Date expiryStartDate;

    /**
     * 有效期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    // @Future(message = "有效期不能早于当前时间")
    private java.util.Date expiryDate;

    /**
     * 效期起始
     **/
    @TableField(exist = false)
    private String certificateExpired;

    /**
     * 签发方
     */
    private String certificateSign;

    /**
     * 签发给
     */
    private String certificateSignTo;

    /**
     * 文档IDs
     */
    private JSONArray docIds;

    /**
     * 当前版本号
     */
    private Integer version;

    /**
     * 资质名称
     */
    @TableField(exist = false)
    private String certificateName;

    /**
     * 限制文件类型
     */
    @TableField(exist = false)
    private String limitFileExtension;

    /**
     * 是否需要有效期
     */
    @TableField(exist = false)
    private Integer needExpiryDate;

    /**
     * 是否需要资质编号
     */
    @TableField(exist = false)
    private Integer needCertificateNo;

    /**
     * 是否授权书
     */
    @TableField(exist = false)
    private Integer isAuthorization;

    /**
     * 文件大小上限
     */
    @TableField(exist = false)
    private String maxiumFileSize;

    /**
     * 文件数上限
     */
    @TableField(exist = false)
    private String maxiumFileCount;

    /**
     * 关闭状态
     */
    private Integer closeFlag;

    /**
     * 提交状态
     */
    private Integer submitFlag;

    /**
     * 厂商id
     */
    private String manufacturerId;

    /**
     * 厂商名称
     */
    private String manufacturerName;

    /**
     * 供应商名称
     */
    private String supplierName;

    /**
     * 品类名称
     */
    private String catalogId;

    /**
     * 品类名称
     */
    private String catalogName;

    /**
     * 品名
     */
    private String materialName;

    /**
     * 品名id hospital_material.material_id 即 material.id
     */
    private String materialId;

    // 资质显示名称
    @TableField(exist = false)
    private String certExtName;

    // 资质过期天数
    @TableField(exist = false)
    private String dayOver;

    /**
     * 是否过期
     */
    @TableField(exist = false)
    private Integer flagDateOver;

    // 操作类型
    @TableField(exist = false)
    private String opType;

    /**
     * 说明
     */
    private String remark;

    public static final int CLOSE_FLAG_NORMAL = 0;
    public static final int CLOSE_FLAG_CLOSED = 1;

    public static final int SUBMIT_FLAG_UNSUBMIT = 0;
    public static final int SUBMIT_FLAG_SUBMITED = 1;

}
